class Solution {
public:
    bool isAnagram(string s, string t) {
        if (s.size() != t.size() || s == t)
            return false;
        int i = 0;
        vector<int> hashtable(26, 0);
        for (const auto ch : s)
            hashtable[ch - 'a']++;
        for (const auto ch : t)
        {
            hashtable[ch - 'a']--;
            if (hashtable[ch - 'a'] < 0)
                return false;
        }
        return true;
    }
};